/*
 * Created on 2005-10-9
 */
package com.smartdio.company.editor;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Spinner;
import org.eclipse.swt.widgets.Text;

import com.smartdio.company.model.Person;
import com.smartdio.company.views.DepartmentCombo;

public class PersonPersonPanel extends Composite {

	private Group group = null;
	private Group group1 = null;
	private Label label = null;
	Button radioButton = null;
	Button radioButton1 = null;
	private Label label1 = null;
	Text textBorn = null;
	private Label label2 = null;
	private Label label3 = null;
	Text textIdCard = null;
	private Label label6 = null;
	Text textEduLevel = null;
	private Label label8 = null;
	private Label label10 = null;
	private Label label11 = null;
	private Label label12 = null;
	Text text4 = null;
	Text text5 = null;
	Text text6 = null;
	Text text7 = null;
	private Label label13 = null;
	Combo combo = null;
	private Label label4 = null;
	Text fullName = null;
	private Label label5 = null;
	Text personnelNumber = null;
	DepartmentCombo departmentCombo = null;
	private Label label9 = null;
	Spinner spinAge = null;

	public PersonPersonPanel(Composite parent, int style) {
		super(parent, style);
		initialize();
	}

	private void initialize() {
		GridLayout gridLayout = new GridLayout();
		gridLayout.numColumns = 2;
		createGroup();
		createGroup1();
		this.setLayout(gridLayout);
		setSize(new Point(516, 200));
	}

	/**
	 * This method initializes group
	 * 
	 */
	private void createGroup() {
		GridData gridData53 = new GridData();
		gridData53.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
		GridData gridData52 = new GridData();
		gridData52.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
		GridData gridData51 = new GridData();
		gridData51.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
		GridData gridData50 = new GridData();
		gridData50.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
		GridData gridData49 = new GridData();
		gridData49.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
		GridData gridData48 = new GridData();
		gridData48.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
		GridData gridData13 = new GridData();
		gridData13.horizontalSpan = 2;
		gridData13.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
		gridData13.grabExcessHorizontalSpace = true;
		GridData gridData12 = new org.eclipse.swt.layout.GridData();
		gridData12.grabExcessHorizontalSpace = true;
		gridData12.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
		gridData12.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
		GridData gridData6 = new org.eclipse.swt.layout.GridData();
		gridData6.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
		gridData6.grabExcessHorizontalSpace = true;
		gridData6.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
		GridData gridData5 = new org.eclipse.swt.layout.GridData();
		gridData5.horizontalSpan = 2;
		gridData5.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
		gridData5.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
		GridData gridData4 = new org.eclipse.swt.layout.GridData();
		gridData4.horizontalSpan = 2;
		gridData4.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
		gridData4.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
		GridData gridData2 = new org.eclipse.swt.layout.GridData();
		gridData2.horizontalSpan = 2;
		gridData2.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
		gridData2.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
		gridData2.grabExcessHorizontalSpace = true;
		GridData gridData = new org.eclipse.swt.layout.GridData();
		gridData.grabExcessHorizontalSpace = true;
		gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
		gridData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
		gridData.grabExcessVerticalSpace = true;
		GridLayout gridLayout1 = new GridLayout();
		gridLayout1.numColumns = 3;
		group = new Group(this, SWT.NONE);
		group.setText("%person");
		group.setLayoutData(gridData);
		group.setLayout(gridLayout1);
		label4 = new Label(group, SWT.NONE);
		label4.setText("%personnelName");
		label4.setLayoutData(gridData48);
		fullName = new Text(group, SWT.BORDER);
		fullName.setLayoutData(gridData13);
		label = new Label(group, SWT.NONE);
		label.setText("%personnelSex");
		label.setLayoutData(gridData49);
		radioButton = new Button(group, SWT.RADIO);
		radioButton.setText("%male");
		radioButton.setLayoutData(gridData6);
		radioButton1 = new Button(group, SWT.RADIO);
		radioButton1.setText("%female");
		radioButton1.setLayoutData(gridData12);
		label1 = new Label(group, SWT.NONE);
		label1.setText("%personnelBorn");
		label1.setLayoutData(gridData50);
		textBorn = new Text(group, SWT.BORDER);
		textBorn.setLayoutData(gridData2);
		label2 = new Label(group, SWT.NONE);
		label2.setText("%personnelAge");
		label2.setLayoutData(gridData51);
		spinAge = new Spinner(group, SWT.NONE);
		label9 = new Label(group, SWT.NONE);
		label3 = new Label(group, SWT.NONE);
		label3.setText("%personnelIDCard");
		label3.setLayoutData(gridData52);
		textIdCard = new Text(group, SWT.BORDER);
		textIdCard.setLayoutData(gridData4);
		label6 = new Label(group, SWT.NONE);
		label6.setText("%personnelEduclevel");
		label6.setLayoutData(gridData53);
		textEduLevel = new Text(group, SWT.BORDER);
		textEduLevel.setLayoutData(gridData5);
	}

	/**
	 * This method initializes group1
	 * 
	 */
	private void createGroup1() {
		GridData gridData19 = new GridData();
		gridData19.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
		GridData gridData18 = new GridData();
		gridData18.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
		GridData gridData17 = new GridData();
		gridData17.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
		GridData gridData16 = new GridData();
		gridData16.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
		GridData gridData15 = new GridData();
		gridData15.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
		GridData gridData11 = new GridData();
		gridData11.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
		GridData gridData14 = new GridData();
		gridData14.grabExcessHorizontalSpace = true;
		gridData14.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
		GridData gridData10 = new org.eclipse.swt.layout.GridData();
		gridData10.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
		gridData10.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
		GridData gridData9 = new org.eclipse.swt.layout.GridData();
		gridData9.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
		gridData9.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
		GridData gridData8 = new org.eclipse.swt.layout.GridData();
		gridData8.grabExcessHorizontalSpace = true;
		gridData8.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
		gridData8.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
		GridData gridData7 = new org.eclipse.swt.layout.GridData();
		gridData7.grabExcessHorizontalSpace = true;
		gridData7.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
		gridData7.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
		GridData gridData1 = new org.eclipse.swt.layout.GridData();
		gridData1.grabExcessHorizontalSpace = true;
		gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
		gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
		gridData1.grabExcessVerticalSpace = true;
		GridLayout gridLayout2 = new GridLayout();
		gridLayout2.numColumns = 2;
		group1 = new Group(this, SWT.NONE);
		group1.setText("%department");
		group1.setLayoutData(gridData1);
		group1.setLayout(gridLayout2);
		label5 = new Label(group1, SWT.NONE);
		label5.setText("%personnelNumber");
		label5.setLayoutData(gridData11);
		personnelNumber = new Text(group1, SWT.BORDER);
		personnelNumber.setLayoutData(gridData14);
		label8 = new Label(group1, SWT.NONE);
		label8.setText("%personnelWorkStart");
		label8.setLayoutData(gridData15);
		text4 = new Text(group1, SWT.BORDER);
		text4.setLayoutData(gridData7);
		label10 = new Label(group1, SWT.NONE);
		label10.setText("%personnelAbdicate");
		label10.setLayoutData(gridData16);
		text5 = new Text(group1, SWT.BORDER);
		text5.setLayoutData(gridData8);
		label11 = new Label(group1, SWT.NONE);
		label11.setText("%personnelLaborage");
		label11.setLayoutData(gridData17);
		text6 = new Text(group1, SWT.BORDER);
		text6.setLayoutData(gridData9);
		label12 = new Label(group1, SWT.NONE);
		label12.setText("%personnelHeadship");
		label12.setLayoutData(gridData18);
		text7 = new Text(group1, SWT.BORDER);
		text7.setLayoutData(gridData10);
		label13 = new Label(group1, SWT.NONE);
		label13.setText("%personnelDepartment");
		// createCombo();
		label13.setLayoutData(gridData19);
		createDepartmentCombo();
	}

	/**
	 * This method initializes departmentCombo
	 * 
	 */
	private void createDepartmentCombo() {
		departmentCombo = new DepartmentCombo(group1, SWT.NONE);
	}

	public void setValue(Person person) {
		this.fullName.setText(person.name);
		if(person.gender){
			this.radioButton.setSelection(true);
			this.radioButton1.setSelection(false);
		}else{
			this.radioButton.setSelection(false);
			this.radioButton1.setSelection(true);
		}
	}

	public void addModifyListener(ModifyListener ls) {
		fullName.addModifyListener(ls);
	}

	/**
	 * This method initializes combo
	 * 
	 */
	/*
	 * private void createCombo() { GridData gridData11 = new
	 * org.eclipse.swt.layout.GridData(); gridData11.horizontalAlignment =
	 * org.eclipse.swt.layout.GridData.FILL; gridData11.verticalAlignment =
	 * org.eclipse.swt.layout.GridData.CENTER; combo = new Combo(group1,
	 * SWT.NONE); combo.setLayoutData(gridData11); }
	 */

} // @jve:decl-index=0:visual-constraint="10,10"
